﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace NFine.EntityFramework.Migrations
{
    public partial class WxAccount_Add_Tenant : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<long>(
                name: "TenantId",
                table: "wx_account",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.CreateIndex(
                name: "IX_wx_account_TenantId",
                table: "wx_account",
                column: "TenantId");

            migrationBuilder.AddForeignKey(
                name: "FK_wx_account_sys_tenant_TenantId",
                table: "wx_account",
                column: "TenantId",
                principalTable: "sys_tenant",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_wx_account_sys_tenant_TenantId",
                table: "wx_account");

            migrationBuilder.DropIndex(
                name: "IX_wx_account_TenantId",
                table: "wx_account");

            migrationBuilder.DropColumn(
                name: "TenantId",
                table: "wx_account");
        }
    }
}
